{{useCss "app-pages/css/main.scss",(["/main.html","/"]) }}

{{#> "mobile_picwall"}}

<!-- goods -->
<div class="_main_goods">
	{{#each $Cache.main.goods_list}}
		{{#> "mobilemaingoods"}}
	{{/each}}

	{{#each $Cache.main.tags}}
		{{#> "tag-goods-list","$This",5>$Index&&detail_content.length>0}}
	{{/each}}
</div>

<div class="bottom">
	<href to="/goods_list.html?id=3">点此查看更多商品</href>
</div>

<xmp type="template" name="mobile_picwall">
	<div class="picwall">
		<div class="carosule">
			<div class="pic-show">
			{{#if bus_info.config.home_imgs.length }}
				{{#each bus_info.config.home_imgs}}
				<div style="z-index:{{$Parent.length-$Index}}" class="pic">
					<href target="_blank" bind-to="{{href||'javascript:void 0'}}">
						<img bind-src="{{img_url}}?imageView/1/w/500/h/200" />
					</href>
				</div>
				{{/each}}
			{{#else}}
				<div style="z-index:{{$Parent.length-$Index}}" class="pic">
					<href target="_blank" bind-to="{{href||'javascript:void 0'}}">
						<img bind-src="/images/default_bg.jpg" />
					</href>
				</div>
			{{/if}}
			</div>
		</div>
	</div>
	<script type="text/vm">
		function(vm) {
			var picwall = vm.queryElement({
				className: 'picwall'
			})[0];
			require(["jQuery"], function($) {
				var $picwall = $(picwall);
				//轮播指针
				var i = 0;
				//固定比例
				var w = $picwall.width();
				var h = w * 0.4;
				$picwall.height(h);

				var timer = setInterval(function _() {
					var pics = $picwall.find(".pic");
					var len = $(pics).length;
					$(pics[(i - 1) % len]).stop().fadeOut(1000);
					$(pics[i % len]).stop().fadeIn(1000);
					i += 1;
					return _;
				}(), 5000);
			});
		}
	</script>
</xmp>

<xmp type="template" name="mobilemaingoods">
	<div class="mobilemaingoods">
		<href to="/goods_details.html?id={{_id}}">
			<img bind-src="{{preview_img_url}}?imageView/1/h/150/w/150" />
			<div class="goods_info">
					<div class="item">{{goods_name}}</div>
				<div class="item">
					<span class="price">
						￥{{#Fixed card_cash_map[$Top.loginer.current_card_factory_id]||cash}}
					</span>
				</div>
			</div>
		</href>
	</div>
</xmp>
<xmp type="template" name="tag-goods-list">
	<div class="main_tag_title">{{tag_name}}</div>
	{{#each detail_content}}
		{{#> "mobilemaingoods","$This",6 > $Index}}
	{{/each}}
</xmp>